package com.nail.api.customMake.dao;

import com.nail.api.customMake.bean.Address;
import com.nail.dao.IBaseDao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IAddressDao extends IBaseDao<Address> {

    @Select("select * from address where user_id = #{userId}")
    List<Address> getAddressByUserId(@Param("userId") Long userId);


    @Select("select * from address where user_id = #{userId} and id = #{addressId}")
    List<Address> getAddressByUserIdAndAddressId(@Param("userId") Long userId, @Param("addressId")Long addressId);

    @Delete("delete from address where id = #{id} and order_id = #{orderId}")
    public void deleteByUserIdAndId(@Param("id")Long id,@Param("userId") Long userId);

}
